﻿using AutoMapper;

namespace Chat_Model.ViewModel
{
    /// <summary>
    /// 消息回复
    /// </summary>
    public class LarTalkRecordsProfile : Profile
    {


        public LarTalkRecordsProfile()
        {
            CreateMap<LarTalkRecords, LarTalkRecordsDto>()
                .ForMember(x => x.Talktype, x => x.MapFrom(x => x.TalkType))
                .ForMember(x => x.Receive_id, x => x.MapFrom(x => x.ReceiverId))
                .ForMember(x => x.FriendId, x => x.MapFrom(x => x.LarUsersFriends.Id))
                .ForMember(x => x.TalkListId, x => x.MapFrom(x => x.LarTalkList.Id))
                .ForMember(x=>x.Source,x=>x.MapFrom(x=>x.TalkType))
                .ForMember(x => x.Nickname, x => x.MapFrom(x => string.IsNullOrWhiteSpace(x.LarUsersFriends.Remark) ? x.LarUsers.Nickname : x.LarUsersFriends.Remark));
            

        }
    }
}
